﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

namespace CARE
{
    public partial class InoculationStrategies : Page, IWizardButtonController
    {
        private Source networkSource;
        private InoculationPanel inoculationPanel;

        public InoculationStrategies()
        {
            InitializeComponent();

            networkSource = new Source(this);
            wizard.Pages.Add(networkSource);
            inoculationPanel = new InoculationPanel(this);
            wizard.Pages.Add(inoculationPanel);

            DisableNext();

            wizard.PageEvent += new WizardPageEvent(WizardMenu_PageEvent);
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        #region IWizardButtonController Members

        public void EnableNext()
        {
            wizard.btNext.IsEnabled = true;
        }

        public void DisableNext()
        {
            wizard.btNext.IsEnabled = false;
        }

        #endregion

        private void WizardMenu_PageEvent(Wizard sender, WizardEventArgs e)
        {
            if (e.Action == WizardAction.Finish || e.Action == WizardAction.Exit)
            {
                DisableNext();
                wizard.btNext.Content = "Next";
                wizard.ctrPageHost.SwitchPage(wizard.Pages[0]);
                //root.LoadMainMenu();
            }
            else if (e.NewPageIndex == 0)
            { // Network source
                wizard.btNext.Content = "Next";
                DisableNext();
            }
            else if (e.NewPageIndex == 1)
            { // Inoculation panel
                wizard.btPrevious.IsEnabled = true;
                inoculationPanel.Init();
            }
        }
    }
}
